package ncrnadb.ncinetview.internal;

import java.util.Properties;

import org.cytoscape.application.CyApplicationManager;
import org.cytoscape.model.CyNetworkFactory;
import org.cytoscape.model.CyNetworkManager;
import org.cytoscape.service.util.AbstractCyActivator;
import org.osgi.framework.BundleContext;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;

public class CyActivator extends AbstractCyActivator {
	
//	private static final Logger LOGGER = LoggerFactory.getLogger(CyActivator.class);
//	
	public CyActivator() {
		super();
//		LOGGER.info("Creating ncINetView bundle activator...");
	}

	@Override
	public void start(BundleContext context) throws Exception {
		
		System.setProperty("org.osgi.framework.bootdelegation", "sun.misc");
//		LOGGER.info("Starting ncINetView app...");
		
//		System.out.println("------------------------------------------------------------------------------------");
//		System.out.println("-ncRNA-DB-");
//		System.out.println("------------------------------------------------------------------------------------");
		
		CyApplicationManager cyApplicationManager = getService(context, CyApplicationManager.class);
		
		MenuAction action = new MenuAction(cyApplicationManager, "ncINetView ");
		
		Properties properties = new Properties();
		
		registerAllServices(context, action, properties);
		
		
		NcINetViewApp.app().setBundleContext(context);
		NcINetViewApp.app().setCyActivator(this);
		
		CyNetworkManager cnm = getService(context, CyNetworkManager.class);
		NcINetViewApp.app().cnm = cnm;
        NcINetViewApp.app().networkFactory = getService(context, CyNetworkFactory.class);
        NcINetViewApp.app().networkManager = getService(context, CyNetworkManager.class);
	}

}
